import {
	request,
	baseUrl
} from "../../request.js"

/**
 * 1，实名认证
 */
export function identifyCheck(name, idCard, password) {
	return request({
		url: baseUrl + '/identity/authAccount',
		method: 'POST',
		data: {
			userId: uni.getStorageSync('userId'),
			realName: name,
			idCard: idCard,
			password
		}
	})
}

/**
 * 2，检验是否实名认证
 * @param {Object} reqData
 */
export function judgeCheck() {
	return request({
		url: baseUrl + '/identity/judgeCheck',
		method: 'GET',
		data: {
			userId: uni.getStorageSync('userId')
		}
	})
}

/**
 * 3，查询实名认证姓名
 * @param {Object} reqData
 */
export function queryName() {
	return request({
		url: baseUrl + '/identity/queryName',
		method: 'GET',
		data: {
			userId: uni.getStorageSync('userId')
		}
	})
}

/**
 * 4，查询用户是否绑定过提现方式
 */
export function queryIsBinding() {
	return request({
		url: baseUrl + '/binding/queryIsBinding',
		method: 'GET',
		data: {
			userId: uni.getStorageSync('userId')
		}
	})
}

/**
 * 5，用户绑定提现账户
 * @param {Object} req
 */
export function insertBinding(req) {
	return request({
		url: baseUrl + '/binding/insertBinding',
		method: 'POST',
		data: {
			typeId: req.typeId,
			typeName: req.typeName,
			userId: uni.getStorageSync('userId'),
			name: req.name,
			idCard: req.idCard,
			phone: req.phone,
			photograph: req.photograph
		}
	})
}

/**
 * 6，验证身份证信息是否正确
 * @param {Object} req
 */
export function queryBindingByIdCard(req) {
	return request({
		url: baseUrl + '/binding/queryBindingByIdCard',
		method: 'POST',
		data: {
			userId: uni.getStorageSync('userId'),
			name: req.name,
			idCard: req.idCard,
			phone: req.phone
		}
	})
}

/**
 * 7，验证密码是否输入正确
 * @param {Object} pwd
 */
export function judgePwd(pwd) {
	return request({
		url: baseUrl + '/wallet/judgePwd',
		method: 'POST',
		data: {
			userId: uni.getStorageSync('userId'),
			newPwd: pwd
		}
	})
}

/**
 * 8，解除支付宝提现绑定
 * @param {Object} phone
 * @param {Object} name
 */
export function secureBinding(phone, name) {
	return request({
		url: baseUrl + '/binding/secureBinding',
		method: 'POST',
		data: {
			userId: uni.getStorageSync('userId'),
			phone,
			name
		}
	})
}